﻿using Mono.Cecil;

namespace OpenReflect.Test.BuilderTests
{
	public static class TestHelper
	{
		internal static MethodDefinition CreateMethodDefinition(TypeDefinition typeDef, string name)
		{
			for (int i = 0; i < typeDef.Methods.Count; i++)
			{
				if (typeDef.Methods[i].Name == name)
				{
					return typeDef.Methods[i];
				}
			}
			return null;
		}

		internal static ParameterDefinition CreateParameterDefinition(MethodDefinition m, string name)
		{
			for (int i = 0; i < m.Parameters.Count; i++)
			{
				if (m.Parameters[i].Name == name)
				{
					return m.Parameters[i];
				}
			}
			return null;
		}
	}
}